export class McData {
    private url: string = null;
    private frameRate: number = 0;
    private frameCount: number = 0;
    private frameMap: {[key: number]: Laya.Texture} = null;

    constructor(url: string, frameRate: number, frameCount: number, frameMap: {[key: number] : Laya.Texture}) {
        this.url = url;
        this.frameRate = frameRate;
        this.frameCount = frameCount;
        this.frameMap = frameMap;
    }

    public clear() : void {
        this.url = null;
        this.frameMap = null;
    }

    /********************************************************************************
     * Getter && Setter
     ********************************************************************************/
    public getUrl() : string {
        return this.url;
    }

    public getFrameRate() : number {
        return this.frameRate;
    }

    public setFrameRate(frameRate: number) : void {
        this.frameRate = frameRate;
    }

    public getFrameCount() : number {
        return this.frameCount;
    }

    public setFrameCount(frameCount: number) : void {
        this.frameCount = frameCount;
    }

    public getFrameMap() : {[key: number] : Laya.Texture} {
        return this.frameMap;
    }

    public getFrame(frameIdx: number) : Laya.Texture {
        let key: string = `${this.url}#${frameIdx}`;
        return this.frameMap[key];
    }
}